<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const user = {
            name:'小雨',
            age:20,
            bf:{
                name:'周',
                age:18
            }
        }
        const proxyUser = new Proxy(user,{
            get(target,prop,a){
                // console.log('get方法调用了',prop,target,a);
                return Reflect.get(target,prop)
            },
            set(target,prop,val){
                console.log('set方法调用了',target,prop,val);
                return Reflect.set(target,prop,val)
            },
            deleteProperty(target,prop) {
                console.log('delete方法调用了');
                return Reflect.deleteProperty(target,prop)
            }
        })
        console.log(proxyUser.name);
        proxyUser.name='大于'
        console.log(proxyUser.name);
        proxyUser.gender = '男'
        console.log(proxyUser.gender );
        delete proxyUser.name
        console.log(user);
        proxyUser.bf.name ='男神'
        console.log(user);
    </script>
</body>
</html>